import request from "@/utils/request";

export const uploadFile = (url, file) => {
  const formData = new FormData();
  formData.append("file", file);
  return request({
    url: url,
    method: "post",
    headers: {
      "Content-Type": "multipart/form-data",
      ignoreCancelToken: true,
    },
    data: formData,
  });
};

/**
 * 获取汇率
 * @returns
 */
export const getCurrencyRate = () => {
  return request({
    url: "/api/CurrencyRate/pb/getRate",
    method: "get",
    params: {
      source: "CNY",
      target: "MXN",
    },
    withoutToken: true,
  });
};

export const register = (data) => {
  return request({
    url: "/api/clients/pb/register",
    method: "post",
    data,
    withoutToken: true,
  });
};

export const login = (data) => {
  return request({
    url: "/api/clients/pb/login",
    method: "post",
    data,
    withoutToken: true,
  });
};

export const faceBookLogin = (data) => {
  return request({
    url: "/api/clients/pb/faceBookLogin",
    method: "post",
    data,
    withoutToken: true,
  });
};

export const getBannerList = () => {
  return request({
    url: "/api/home/pb/getBannerList",
    method: "get",
    withoutToken: true,
  });
};

export const getUserInfo = () => {
  return request({
    url: "/api/clients/getClientInfo",
    method: "post",
  });
};

export const getNavigationList = () => {
  return request({
    url: "/api/home/pb/getNavigationList",
    method: "get",
    withoutToken: true,
  });
};

export const getQAList = () => {
  return request({
    url: "/api/home/pb/getQAList",
    method: "get",
    withoutToken: true,
  });
};

export const getUserAgreement = () => {
  return request({
    url: "/api/home/pb/getUserAgreement",
    method: "get",
    withoutToken: true,
  });
}; 